package com.edu.exam.enums.assessment.generation;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 执行模式枚举
 *
 * @author System
 * @version 1.0.0
 */
public enum ExecutionMode implements BaseEnum {
    SEQUENTIAL("SEQUENTIAL", "顺序执行"),
    PARALLEL("PARALLEL", "并行执行"),
    BATCH("BATCH", "批量执行"),
    STREAMING("STREAMING", "流式执行"),
    MIXED("MIXED", "混合执行"),
    SCHEDULED("SCHEDULED", "定时执行"),
    TRIGGERED("TRIGGERED", "触发执行"),
    CONDITIONAL("CONDITIONAL", "条件执行");

    private final String code;
    private final String description;

    ExecutionMode(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static ExecutionMode fromCode(String code) {
        for (ExecutionMode mode : values()) {
            if (mode.getCode().equals(code)) {
                return mode;
            }
        }
        throw new IllegalArgumentException("Unknown execution mode code: " + code);
    }

    @Override
    public String toString() {
        return code + " - " + description;
    }
}
